.class public Lcom/brixd/niceapp/util/LinkHandler;
.super Ljava/lang/Object;
.source "LinkHandler.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    }
.end annotation


# instance fields
.field private mCommunityDetailRequestCache:Lcom/brixd/niceapp/util/CommunityDetailRequestCache;

.field private mContext:Landroid/content/Context;

.field private mRequestCache:Lcom/brixd/niceapp/util/DetailRequestCache;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 20
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 21
    iput-object p1, p0, Lcom/brixd/niceapp/util/LinkHandler;->mContext:Landroid/content/Context;

    .line 22
    new-instance v0, Lcom/brixd/niceapp/util/DetailRequestCache;

    invoke-direct {v0, p1}, Lcom/brixd/niceapp/util/DetailRequestCache;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/brixd/niceapp/util/LinkHandler;->mRequestCache:Lcom/brixd/niceapp/util/DetailRequestCache;

    .line 23
    new-instance v0, Lcom/brixd/niceapp/util/CommunityDetailRequestCache;

    invoke-direct {v0, p1}, Lcom/brixd/niceapp/util/CommunityDetailRequestCache;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/brixd/niceapp/util/LinkHandler;->mCommunityDetailRequestCache:Lcom/brixd/niceapp/util/CommunityDetailRequestCache;

    .line 24
    return-void
.end method

.method private internalRedirect(Ljava/lang/String;Z)Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    .registers 11
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "handleCommonUrl"    # Z

    .prologue
    .line 43
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_9

    .line 44
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->NOTHING:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    .line 75
    :cond_8
    :goto_8
    return-object v3

    .line 47
    :cond_9
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->NOTHING:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    .line 49
    .local v3, "ret":Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    :try_start_b
    const-string v6, "zuimeia.com/app/title/"

    invoke-virtual {p1, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_23

    .line 50
    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v6

    invoke-virtual {v6}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;

    move-result-object v5

    .line 51
    .local v5, "title":Ljava/lang/String;
    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mRequestCache:Lcom/brixd/niceapp/util/DetailRequestCache;

    invoke-virtual {v6, v5}, Lcom/brixd/niceapp/util/DetailRequestCache;->gotoDetail(Ljava/lang/String;)V

    .line 52
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->GOTO_DAILY_DETAIL:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    .line 53
    goto :goto_8

    .end local v5    # "title":Ljava/lang/String;
    :cond_23
    const-string v6, "zuimeia.com/community/app/category/title/"

    invoke-virtual {p1, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_4f

    .line 54
    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v6

    invoke-virtual {v6}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;

    move-result-object v5

    .line 55
    .restart local v5    # "title":Ljava/lang/String;
    new-instance v4, Lcom/brixd/niceapp/model/TagModel;

    const/4 v6, -0x1

    invoke-direct {v4, v6, v5}, Lcom/brixd/niceapp/model/TagModel;-><init>(ILjava/lang/String;)V

    .line 56
    .local v4, "tagModel":Lcom/brixd/niceapp/model/TagModel;
    new-instance v2, Landroid/content/Intent;

    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mContext:Landroid/content/Context;

    const-class v7, Lcom/brixd/niceapp/community/activity/AppFilterActivity;

    invoke-direct {v2, v6, v7}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 57
    .local v2, "intent":Landroid/content/Intent;
    const-string v6, "Tag"

    invoke-virtual {v2, v6, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 58
    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mContext:Landroid/content/Context;

    invoke-virtual {v6, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 59
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->GOTO_CUMMUNITY_TAGS:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    .line 60
    goto :goto_8

    .end local v2    # "intent":Landroid/content/Intent;
    .end local v4    # "tagModel":Lcom/brixd/niceapp/model/TagModel;
    .end local v5    # "title":Ljava/lang/String;
    :cond_4f
    const-string v6, "zuimeia.com/community/app/"

    invoke-virtual {p1, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_6b

    .line 61
    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v6

    invoke-virtual {v6}, Landroid/net/Uri;->getLastPathSegment()Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    .line 62
    .local v0, "appId":I
    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mCommunityDetailRequestCache:Lcom/brixd/niceapp/util/CommunityDetailRequestCache;

    invoke-virtual {v6, v0}, Lcom/brixd/niceapp/util/CommunityDetailRequestCache;->gotoDetail(I)V

    .line 63
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->GOTO_COMMUNITY_DETAIL:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    .line 64
    goto :goto_8

    .end local v0    # "appId":I
    :cond_6b
    if-eqz p2, :cond_8

    .line 65
    new-instance v2, Landroid/content/Intent;

    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mContext:Landroid/content/Context;

    const-class v7, Lcom/brixd/niceapp/activity/WebViewActivity;

    invoke-direct {v2, v6, v7}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 66
    .restart local v2    # "intent":Landroid/content/Intent;
    const-string v6, "URL"

    invoke-virtual {v2, v6, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 67
    iget-object v6, p0, Lcom/brixd/niceapp/util/LinkHandler;->mContext:Landroid/content/Context;

    invoke-virtual {v6, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 68
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->GOTO_WEB_VIEW:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    :try_end_82
    .catch Ljava/lang/Exception; {:try_start_b .. :try_end_82} :catch_83

    goto :goto_8

    .line 70
    .end local v2    # "intent":Landroid/content/Intent;
    :catch_83
    move-exception v1

    .line 71
    .local v1, "e":Ljava/lang/Exception;
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    .line 72
    sget-object v3, Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;->NOTHING:Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    goto/16 :goto_8
.end method


# virtual methods
.method public redirectUrl(Ljava/lang/String;)Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    .registers 3
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    .line 31
    const/4 v0, 0x1

    invoke-direct {p0, p1, v0}, Lcom/brixd/niceapp/util/LinkHandler;->internalRedirect(Ljava/lang/String;Z)Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    move-result-object v0

    return-object v0
.end method

.method public redirectUrlToDetail(Ljava/lang/String;)Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;
    .registers 3
    .param p1, "url"    # Ljava/lang/String;

    .prologue
    .line 39
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/brixd/niceapp/util/LinkHandler;->internalRedirect(Ljava/lang/String;Z)Lcom/brixd/niceapp/util/LinkHandler$RedirectResult;

    move-result-object v0

    return-object v0
.end method
